package com.example.administrator.xinyutg.activity;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.RadioGroup;

import com.example.administrator.xinyutg.R;
import com.example.administrator.xinyutg.fragment.GroupFragment;
import com.example.administrator.xinyutg.fragment.MoreFragment;
import com.example.administrator.xinyutg.fragment.MyFragment;
import com.example.administrator.xinyutg.fragment.SellerFragment;
import com.example.administrator.xinyutg.utils.FragmentUtil;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private RadioGroup rg;
    private List<Fragment> listFg;
    private FragmentManager fm=getSupportFragmentManager();
    private FragmentUtil fUtil;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initView();

    }

    private void initView() {
        rg = (RadioGroup) findViewById(R.id.main_rg);
        listFg = new ArrayList<Fragment>();
        listFg.add(new GroupFragment());
        listFg.add(new SellerFragment());
        listFg.add(new MyFragment());
        listFg.add(new MoreFragment());
        fUtil = new FragmentUtil(listFg, R.id.main_frame,fm,rg);
        //fUtil.onCheckedChanged(rg,rg.getCheckedRadioButtonId());

    }

}
